package cn.eud360.xiangmu.dmp.etl

import cn.eud360.xiangmu.dmp.config.ConfigHelper
import org.apache.spark.sql.{DataFrame, SQLContext}
import org.apache.spark.{SparkConf, SparkContext}

object Sql4Parquet {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf()
      .setMaster("local[*]")
      .setAppName("读取parquet文件")
      .set("spark.serializer", ConfigHelper.serializer) //序列化
    val sc: SparkContext = new SparkContext(conf)
    val sqlcontext: SQLContext = new SQLContext(sc)
    import sqlcontext.implicits._
    val readframe: DataFrame = sqlcontext.read.parquet("E:\\parquet31-2\\provincename=山东省")
    readframe.registerTempTable("t_sd")
    sqlcontext.sql("select * from t_sd").show()
    //readframe.show()
  }
}
